package com.arithmetic.dynamic;

import java.util.Scanner;

/**
 * 斐波那契数列
 * <p>
 * 大家都知道斐波那契数列，现在要求输入一个正整数 n ，请你输出斐波那契数列的第 n 项。
 * f(1) = 1;
 * f(2) = 1;
 * f(n) = f(n-1) + f(n-2)
 *
 * @author chenyichang
 * @since 2022/8/29
 */
public class Fibonacci {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int num = s.nextInt();
        if (num == 1 || num == 2) {
            System.out.println(1);
            return;
        }
        int result = 0;
        int f1 = 1;
        int f2 = 1;
        for (int i = 3; i <= num; i++) {
            result = f1 + f2;
            f1 = f2;
            f2 = result;
        }
        System.out.println(result);
    }
}
